<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    省<select id="sheng">
        
    </select>
    市<select id="shi">
        <option></option>
    </select>
    <script>
        var data = [{sheng:'辽宁', cites:['沈阳', '大连', '鞍山', '锦州']},
                     {sheng:'江苏', cites:['南京', '无锡', '南通', '苏州', '常州']}
                    ]

        // 初始化省数据
        data.forEach((n,i) => {
            // 创建option
            var opt = document.createElement("option");
            opt.value = i;
            opt.innerHTML = n.sheng;

            // 把option放入 select
            document.getElementById("sheng").append(opt)
        });
       
        
        document.getElementById("sheng").onchange = abc = function() {

            var index = document.getElementById("sheng").value;
            document.getElementById("shi").innerHTML = "";
            data[index].cites.forEach((n,i) => {
                // 创建option
                var opt = document.createElement("option");
                opt.value = i;
                opt.innerHTML = n;
    
                // 把option放入 select
                document.getElementById("shi").append(opt)
            })
        }

        abc()

        var a1 = [1, 3, 5];
        a1.forEach(function(n, i) {
            console.info(`下标是i:${i} 值是n:${n}`)   
        })

        var a2 = {a:1, b:"tom", c:function(){}}
        function abc() {
            
        }
    </script>
</body>
</html>